/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package sv.com.globalsolutionslt.entidades;

import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author karinaMelara
 */
@Entity
@Table(name = "idioma_persona", catalog = "bolsadetrabajo", schema = "")
@XmlRootElement
@NamedQueries({
    @NamedQuery(name = "IdiomaPersona.findAll", query = "SELECT i FROM IdiomaPersona i"),
    @NamedQuery(name = "IdiomaPersona.findByIdIdiomaPersona", query = "SELECT i FROM IdiomaPersona i WHERE i.idIdiomaPersona = :idIdiomaPersona")})
public class IdiomaPersona implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id_idioma_persona", nullable = false)
    private Integer idIdiomaPersona;
    @JoinColumn(name = "id_persona", referencedColumnName = "id_persona", nullable = false)
    @ManyToOne(optional = false)
    private Persona idPersona;
    @JoinColumn(name = "id_idioma", referencedColumnName = "id_idioma", nullable = false)
    @ManyToOne(optional = false)
    private Idioma idIdioma;

    public IdiomaPersona() {
    }

    public IdiomaPersona(Integer idIdiomaPersona) {
        this.idIdiomaPersona = idIdiomaPersona;
    }

    public Integer getIdIdiomaPersona() {
        return idIdiomaPersona;
    }

    public void setIdIdiomaPersona(Integer idIdiomaPersona) {
        this.idIdiomaPersona = idIdiomaPersona;
    }

    public Persona getIdPersona() {
        return idPersona;
    }

    public void setIdPersona(Persona idPersona) {
        this.idPersona = idPersona;
    }

    public Idioma getIdIdioma() {
        return idIdioma;
    }

    public void setIdIdioma(Idioma idIdioma) {
        this.idIdioma = idIdioma;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idIdiomaPersona != null ? idIdiomaPersona.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof IdiomaPersona)) {
            return false;
        }
        IdiomaPersona other = (IdiomaPersona) object;
        if ((this.idIdiomaPersona == null && other.idIdiomaPersona != null) || (this.idIdiomaPersona != null && !this.idIdiomaPersona.equals(other.idIdiomaPersona))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "sv.com.globalsolutionslt.entidades.IdiomaPersona[ idIdiomaPersona=" + idIdiomaPersona + " ]";
    }
    
}
